#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date    : 2018-03-15 18:21:23

import tornado.web
import methods.db
# import sys
# import os.path


# sys.path.append(os.path)


class IndexHandler(tornado.web.RequestHandler):
    def get(self):
        self.render('index.html')

    def post(self):
        username = self.get_argument('username')
        password = self.get_argument('password')
        sql = "select * from userInfo where name='%s' and password='%s'" % (
            username, password)
        user_info = methods.db.selectRow(sql, 'tornado')
        if len(user_info) == 0:
            self.write('用户%s不存在,或者密码错误' % (username))
        else:
            self.write('验证正确,用户:%s\n密码:%s' % (username, password))
        print('用户:%s\n密码:%s' % (username, password))


if __name__ == '__main__':
    print('test')
